package cn.yilongquan.user.domain;// 统一响应体
import lombok.Data;

@Data
public class ResultVO<T> {
    private Integer code;
    private String msg;
    private T data;
    private boolean success;

    public static <T> ResultVO<T> success(T data) {
        ResultVO<T> result = new ResultVO<>();
        result.setCode(200);
        result.setSuccess(true);
        result.setData(data);
        result.setMsg("操作成功");
        return result;
    }

    public static <T> ResultVO<T> error(String msg) {
        ResultVO<T> result = new ResultVO<>();
        result.setCode(500);
        result.setSuccess(false);
        result.setMsg(msg);
        return result;
    }
}